#include<iostream>
#include<stdio.h>
#define maxsize 1000
using namespace std;
typedef int ElemType;
typedef struct {
	ElemType data[maxsize];
	int front,rear;
} SqQueue;
void number(SqQueue *A,SqQueue *B,int n);
void InitQueue(SqQueue *&q);
bool enQueue(SqQueue *&q,ElemType e);
bool deQueue(SqQueue *&q,ElemType &e);
int main(){
	SqQueue *A,*B;
	int n,i;
	cin>>n;
	InitQueue(A);
	InitQueue(B);
	int a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
		if(a[i]%2==0){
			enQueue(B,a[i]);
		}
		else{
			enQueue(A,a[i]);
		}
	}
	number(A,B,n);
	return 0;
}
void number(SqQueue *A,SqQueue *B,int n){
	ElemType e,count=1;
	while(count!=n+1){
		if(B->front==B->rear){
				while(deQueue(A,e)){
					if(n==1) printf("%d",e);
					else printf("%d ",e);
					if(A->front+1==A->rear){
						deQueue(A,e);
						printf("%d",e);
					}
				}
				break;
			}
		if(A->front==A->rear){
				while(deQueue(B,e)){
					if(n==1) printf("%d",e);
					else printf("%d ",e);
					if(B->front+1==B->rear){
						deQueue(B,e);
						printf("%d",e);
					}
				}
				break;
			}
		if(count%3==0){
			deQueue(B,e);
			if(count==n) printf("%d",e);
			else printf("%d ",e);
			count++;
		}
		else{
			deQueue(A,e);
			if(count==n) printf("%d",e);
			else printf("%d ",e);
			count++;
		}
	}
}
void InitQueue(SqQueue *&q){
	q=new SqQueue;
	q->front=q->rear=0;
}
bool enQueue(SqQueue *&q,ElemType e){
	if(q->rear==maxsize-1){
		return false;
	}
	q->rear++;
	q->data[q->rear]=e;
	return true; 
}
bool deQueue(SqQueue *&q,ElemType &e){
	if(q->front==q->rear){
		return false;
	}
	q->front++;
	e=q->data[q->front];
	return true;
}


